#include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#define int long long 
#define x first 
#define y second 
using namespace std;
const int N =  5;
typedef pair<int,int> PII;
PII p[N];
map<char,int> mp;
void solve()
{
    string s;
    cin >> s;
    for(int i = 0; i < 3; i++)
    {
        mp[s[i]]++;
    }
    int t;
    for(auto c:mp)
    {
       t = min(t,3 - c.y);
    }
    cout << t << endl;
}
signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    int t = 1;
    while(t--) solve();
    return 0;
}